<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>

    //构建一个计算器函数：参数（计算法则，数字1，数字2）、构建一个计算平均值函数，在函数中执行 1.求和，2.求平均数，3.求每个数字与平均数的差
    function jsj(a,b,c){
        switch(a){
            case "+":
            return b+c;
            case "-":
            return b-c;
            case "*":
            return b*c;
            case "/":
            return b/c;
        }
    }
    let b=8;let c=2
    function jieguo(){
        let he=jsj("+",b,c);
        console.log(he);
        let pjs=jsj("/",he,2);
        console.log(pjs);
        let bb=jsj("-",b,pjs);
        let cc=jsj("-",c,pjs)
        console.log (bb);
        console.log (cc);
    }
    jieguo()
</script>
</html>